<template>
  <div class="variable">
    <h3>神奇的变量问题</h3>
    <p><em>下面代码已过期</em></p>
    <del>
      <code>
        let a = 10
        <br />
        {
        <br />
        &nbsp;&nbsp;a = 20
        <br />
        &nbsp;&nbsp;function a() {}
        <br />
        &nbsp;&nbsp;a = 30
        <br />
        }
        <br />
        console.log(a)
        <br />
        a = 40
      </code>
    </del>
    <br />
    <strong>result: 10</strong>
    <hr>
  </div>
</template>
<script setup lang="ts">
import { fun2 } from './funVar'
var a = 10
{
  a = 20
  function a() {}
  a = 30
  console.log('inner: ', a) // 30
  console.log(a === window.a); // false
}
console.log('outer: ', a) // 10
a = 40

var b = 10
{
  var b = 20
}
console.log('b:', b); // 20

fun2()
</script>
<style lang="scss" scoped>
.variable {
  .t-i-2 {
    text-indent: 2em;
  }
}
</style>
